Developer Documentation

QuickTime 4 API Documentation

3D Graphics Programming with QuickDraw 3D 1.5.4

Previous | QD3D Book | Overview | Chapter Contents | Next |

Getting a View's Transforms

QuickDraw 3D provides routines that you can use to get matrix representations of the transforms associated with a view.

You should call these routines only between calls to Q3View_StartRendering and Q3View_EndRendering (or similar submitting loops). If you call them at any other time, they return kQ3Failure .

Q3View_GetLocalToWorldMatrixState

You can use the Q3View_GetLocalToWorldMatrixState function to get a view's local-to-world transform matrix.

TQ3Status Q3View_GetLocalToWorldMatrixState (
                     TQ3ViewObject view,
                     TQ3Matrix4x4 *matrix);
view
A view.
matrix
On exit, a 4-by-4 matrix representing the local-to-world transform of the specified view.

DESCRIPTION

The Q3View_GetLocalToWorldMatrixState function returns, in the matrix parameter, a 4-by-4 matrix that represents the local-to-world transform of the view specified by the view parameter.

Q3View_GetWorldToFrustumMatrixState

You can use the Q3View_GetWorldToFrustumMatrixState function to get a view's world-to-frustum transform matrix.

TQ3Status Q3View_GetWorldToFrustumMatrixState (
                     TQ3ViewObject view,
                     TQ3Matrix4x4 *matrix);
view
A view.
matrix
On exit, a 4-by-4 matrix representing the world-to-frustum transform of the specified view.

DESCRIPTION

The Q3View_GetWorldToFrustumMatrixState function returns, in the matrix parameter, a 4-by-4 matrix that represents the world-to-frustum transform of the view specified by the view parameter.

SPECIAL CONSIDERATIONS

You should call the Q3View_GetWorldToFrustumMatrixState function only from within a rendering loop. Its behavior when called outside a rendering loop is unpredictable.

Q3View_GetFrustumToWindowMatrixState

You can use the Q3View_GetFrustumToWindowMatrixState function to get a view's frustum-to-window transform matrix.

TQ3Status Q3View_GetFrustumToWindowMatrixState (
                     TQ3ViewObject view,
                     TQ3Matrix4x4 *matrix);
view
A view.
matrix
On exit, a 4-by-4 matrix representing the frustum-to-window transform of the specified view.

DESCRIPTION

The Q3View_GetFrustumToWindowMatrixState function returns, in the matrix parameter, a 4-by-4 matrix that represents the frustum-to-window transform of the view specified by the view parameter. The window is either the pixmap associated with a pixmap draw context or the window associated with a window draw context (for example, the Macintosh draw context). If, in a window system draw context, a part of a window (a pane) has been associated with the view, this function returns the matrix that maps the view frustum to that part of the window.

The z value of a point p w in window space obtained by applying the transform returned by Q3View_GetFrustumToWindowMatrixState to a point p f in the frustum space is the z value of point p f (which ranges from 0.0 to 1.0, inclusive). You might use the z value of a transformed point to determine whether that point would be clipped (if the z value is less than 0 or greater than 1.0, the original point lies outside the viewing frustum).


© 1997 Apple Computer, Inc.

Previous | QD3D Book | Overview | Chapter Contents | Next |